package com.jz.community.modulemine.rechargephone.presenter;

import com.jz.community.basecomm.mvp.BaseLifeCyclePresent;
import com.jz.community.basecomm.net.rxandroid.OnLoadListener;
import com.jz.community.modulemine.rechargephone.bean.FareDealBean;
import com.jz.community.modulemine.rechargephone.model.PhoneModel;
import com.jz.community.modulemine.rechargephone.model.PhoneModelImp;
import com.jz.community.modulemine.rechargephone.ui.FareDealView;

public class FareDealPresenter extends BaseLifeCyclePresent<FareDealView.View> implements FareDealView.Presenter {
    private FareDealView.View view;
    private PhoneModel phoneModel;

    public FareDealPresenter(FareDealView.View view) {
        this.view = view;
        this.phoneModel = new PhoneModelImp(view.getContext());
    }

    @Override
    public void initPhoneFare(int page, int size) {
        phoneModel.initPhoneFare(page, size, new OnLoadListener<FareDealBean>() {
            @Override
            public void onSuccess(FareDealBean entity) {
                view.setPhoneFareData(entity);
            }

            @Override
            public void onFail(String msg, int code) {
                view.phoneFareFail(msg);

            }
        });
    }
}
